import request from '@/utils/request'

// 获取菜单树
export function menuTree(parentId) {
  return request({
    url: '/menu/tree',
    method: 'get',
    params: { parentId }
  })
}
// 添加菜单
export function addMenu(data, headers) {
  return request({
    url: '/menu/addnew',
    method: 'post',
    data,
    headers
  })
}
// 删除菜单
export function deleteMenu(id, headers) {
  return request({
    url: '/menu/delete',
    method: 'get',
    params: { id },
    headers
  })
}
// 获取菜单信息
export function getMenuById(id) {
  return request({
    url: '/menu/get',
    method: 'get',
    params: { id }
  })
}
// 修改菜单
export function updateMenu(data, headers) {
  return request({
    url: 'menu/update',
    method: 'post',
    data,
    headers
  })
}
